<template>
    <div class="bot">
        <mt-tabbar v-model="selected" fixed>
            <mt-tab-item v-for="(item,index) in data" :key="index" :id="item.id" @click.native="changRouter(item.id)">
                <!-- <img slot="icon" src="../assets/100x100.png">  -->
                {{item.name}}
            </mt-tab-item>
        </mt-tabbar>
    </div>
</template>
<script>
export default {
  data() {
    return {
      selected: 1,
      data: [
        {
          id: 1,
          // img:require("@/")
          name: "首页"
        },
        {
          id: 2,
          // img:require("@/")
          name: "订单"
        },
        {
          id: 3,
          // img:require("@/")
          name: "发现"
        },
        {
          id: 4,
          // img:require("@/")
          name: "我的"
        }
      ]
    };
  },
  methods:{
      changRouter(id){
          var path = ""
          this.selected = id
          switch (id) {
              case 2:
                  path = '/goods'
                  break;
              case 3:
                  path ='/see'
                  break;
              case 4:
                  path = '/main'
                  break;
              default:
                  path = '/'
                  break;
          } 
        this.$router.push({
            path
        })
      }
  }
};
</script>
<style lang="sass" scoped>

</style>


